import pint

# Initialize Pint UnitRegistry
ureg = pint.UnitRegistry()

# Here, we set constants for the units of the variables in all datasets.
STREAMFLOW_UNITS = {
    "streamflow": "m^3/s",
}
# We prefer to use the hourly era5land data and resample it to daily one, so these units are seldom used.
GEE_ERA5LAND_DAILY_UNITS = {
    "dewpoint_temperature_2m": "kelvin",
    "temperature_2m": "kelvin",
    "skin_temperature": "kelvin",
    "soil_temperature_level_1": "kelvin",
    "soil_temperature_level_2": "kelvin",
    "soil_temperature_level_3": "kelvin",
    "soil_temperature_level_4": "kelvin",
    "lake_bottom_temperature": "kelvin",
    "lake_ice_depth": "meter",
    "lake_ice_temperature": "kelvin",
    "lake_mix_layer_depth": "meter",
    "lake_mix_layer_temperature": "kelvin",
    "lake_shape_factor": "dimensionless",
    "lake_total_layer_temperature": "kelvin",
    "snow_albedo": "dimensionless",
    "snow_cover": "percent",
    "snow_density": "kg/m^3",
    # we didn't use this variable yet, but it repeats with smap data, so we add a postfix "_era5landdaily"
    "snow_depth_era5landdaily": "meter",
    "snow_depth_water_equivalent": "meter",
    "snowfall_sum": "meter/day",
    "snowmelt_sum": "meter/day",
    "temperature_of_snow_layer": "kelvin",
    "skin_reservoir_content": "meter",
    "volumetric_soil_water_layer_1": "dimensionless",
    "volumetric_soil_water_layer_2": "dimensionless",
    "volumetric_soil_water_layer_3": "dimensionless",
    "volumetric_soil_water_layer_4": "dimensionless",
    "forecast_albedo": "dimensionless",
    "surface_latent_heat_flux_sum": "J/m^2/day",
    "surface_net_solar_radiation_sum": "J/m^2/day",
    "surface_net_thermal_radiation_sum": "J/m^2/day",
    "surface_sensible_heat_flux_sum": "J/m^2/day",
    "surface_solar_radiation_downwards_sum": "J/m^2/day",
    "surface_thermal_radiation_downwards_sum": "J/m^2/day",
    "evaporation_from_bare_soil_sum": "meter/day",
    "evaporation_from_open_water_surfaces_excluding_oceans_sum": "meter/day",
    "evaporation_from_the_top_of_canopy_sum": "meter/day",
    "evaporation_from_vegetation_transpiration_sum": "meter/day",
    "potential_evaporation_sum": "meter/day",
    "runoff_sum": "meter/day",
    "snow_evaporation_sum": "meter/day",
    "sub_surface_runoff_sum": "meter/day",
    "surface_runoff_sum": "meter/day",
    "total_evaporation_sum": "meter/day",
    "u_component_of_wind_10m": "meter/second",
    "v_component_of_wind_10m": "meter/second",
    # we didn't use this variable yet, but it repeats with smap data, so we add a postfix "_era5landdaily"
    "surface_pressure_era5landdaily": "pascal",
    "total_precipitation_sum": "meter/day",
    "leaf_area_index_high_vegetation": "dimensionless",
    "leaf_area_index_low_vegetation": "dimensionless",
    "dewpoint_temperature_2m_min": "kelvin",
    "dewpoint_temperature_2m_max": "kelvin",
    "temperature_2m_min": "kelvin",
    "temperature_2m_max": "kelvin",
    "skin_temperature_min": "kelvin",
    "skin_temperature_max": "kelvin",
    "soil_temperature_level_1_min": "kelvin",
    "soil_temperature_level_1_max": "kelvin",
    "soil_temperature_level_2_min": "kelvin",
    "soil_temperature_level_2_max": "kelvin",
    "soil_temperature_level_3_min": "kelvin",
    "soil_temperature_level_3_max": "kelvin",
    "soil_temperature_level_4_min": "kelvin",
    "soil_temperature_level_4_max": "kelvin",
    "lake_bottom_temperature_min": "kelvin",
    "lake_bottom_temperature_max": "kelvin",
    "lake_ice_depth_min": "meter",
    "lake_ice_depth_max": "meter",
    "lake_ice_temperature_min": "kelvin",
    "lake_ice_temperature_max": "kelvin",
    "lake_mix_layer_depth_min": "meter",
    "lake_mix_layer_depth_max": "meter",
    "lake_mix_layer_temperature_min": "kelvin",
    "lake_mix_layer_temperature_max": "kelvin",
    "lake_shape_factor_min": "dimensionless",
    "lake_shape_factor_max": "dimensionless",
    "lake_total_layer_temperature_min": "kelvin",
    "lake_total_layer_temperature_max": "kelvin",
    "snow_albedo_min": "dimensionless",
    "snow_albedo_max": "dimensionless",
    "snow_cover_min": "percent",
    "snow_cover_max": "percent",
    "snow_density_min": "kg/m^3",
    "snow_density_max": "kg/m^3",
    "snow_depth_min": "meter",
    "snow_depth_max": "meter",
    "snow_depth_water_equivalent_min": "meter",
    "snow_depth_water_equivalent_max": "meter",
    "snowfall_min": "meter/day",
    "snowfall_max": "meter/day",
    "snowmelt_min": "meter/day",
    "snowmelt_max": "meter/day",
    "temperature_of_snow_layer_min": "kelvin",
    "temperature_of_snow_layer_max": "kelvin",
    "skin_reservoir_content_min": "meter",
    "skin_reservoir_content_max": "meter",
    "volumetric_soil_water_layer_1_min": "dimensionless",
    "volumetric_soil_water_layer_1_max": "dimensionless",
    "volumetric_soil_water_layer_2_min": "dimensionless",
    "volumetric_soil_water_layer_2_max": "dimensionless",
    "volumetric_soil_water_layer_3_min": "dimensionless",
    "volumetric_soil_water_layer_3_max": "dimensionless",
    "volumetric_soil_water_layer_4_min": "dimensionless",
    "volumetric_soil_water_layer_4_max": "dimensionless",
    "forecast_albedo_min": "dimensionless",
    "forecast_albedo_max": "dimensionless",
    "surface_latent_heat_flux_min": "J/m^2/day",
    "surface_latent_heat_flux_max": "J/m^2/day",
    "surface_net_solar_radiation_min": "J/m^2/day",
    "surface_net_solar_radiation_max": "J/m^2/day",
    "surface_net_thermal_radiation_min": "J/m^2/day",
    "surface_net_thermal_radiation_max": "J/m^2/day",
    "surface_sensible_heat_flux_min": "J/m^2/day",
    "surface_sensible_heat_flux_max": "J/m^2/day",
    "surface_solar_radiation_downwards_min": "J/m^2/day",
    "surface_solar_radiation_downwards_max": "J/m^2/day",
    "surface_thermal_radiation_downwards_min": "J/m^2/day",
    "surface_thermal_radiation_downwards_max": "J/m^2/day",
    "evaporation_from_bare_soil_min": "meter/day",
    "evaporation_from_bare_soil_max": "meter/day",
    "evaporation_from_open_water_surfaces_excluding_oceans_min": "meter/day",
    "evaporation_from_open_water_surfaces_excluding_oceans_max": "meter/day",
    "evaporation_from_the_top_of_canopy_min": "meter/day",
    "evaporation_from_the_top_of_canopy_max": "meter/day",
    "evaporation_from_vegetation_transpiration_min": "meter/day",
    "evaporation_from_vegetation_transpiration_max": "meter/day",
    "potential_evaporation_min": "meter/day",
    "potential_evaporation_max": "meter/day",
    "runoff_min": "meter/day",
    "runoff_max": "meter/day",
    "snow_evaporation_min": "meter/day",
    "snow_evaporation_max": "meter/day",
    "sub_surface_runoff_min": "meter/day",
    "sub_surface_runoff_max": "meter/day",
    "surface_runoff_min": "meter/day",
    "surface_runoff_max": "meter/day",
    "total_evaporation_min": "meter/day",
    "total_evaporation_max": "meter/day",
    "u_component_of_wind_10m_min": "meter/second",
    "u_component_of_wind_10m_max": "meter/second",
    "v_component_of_wind_10m_min": "meter/second",
    "v_component_of_wind_10m_max": "meter/second",
    "surface_pressure_min": "pascal",
    "surface_pressure_max": "pascal",
    "total_precipitation_min": "meter/day",
    "total_precipitation_max": "meter/day",
    "leaf_area_index_high_vegetation_min": "dimensionless",
    "leaf_area_index_high_vegetation_max": "dimensionless",
    "leaf_area_index_low_vegetation_min": "dimensionless",
    "leaf_area_index_low_vegetation_max": "dimensionless",
}
HYDROATLAS_UNITS = {
    "sgr_dk_sav": "decimeters/km",
    "glc_pc_s06": "percent",
    "glc_pc_s07": "percent",
    "nli_ix_sav": "dimensionless",
    "glc_pc_s04": "percent",
    "glc_pc_s05": "percent",
    "glc_pc_s02": "percent",
    "glc_pc_s03": "percent",
    "glc_pc_s01": "percent",
    "pet_mm_syr": "millimeter",
    "glc_pc_s08": "percent",
    "glc_pc_s09": "percent",
    "swc_pc_s09": "percent",
    "ele_mt_smx": "meter",
    "tbi_cl_smj": "dimensionless",
    "swc_pc_s01": "percent",
    "swc_pc_s02": "percent",
    "swc_pc_s03": "percent",
    "swc_pc_s04": "percent",
    "swc_pc_s05": "percent",
    "swc_pc_s06": "percent",
    "swc_pc_s07": "percent",
    "swc_pc_s08": "percent",
    "crp_pc_sse": "percent",
    "glc_pc_s22": "percent",
    "glc_pc_s20": "percent",
    "glc_pc_s21": "percent",
    "wet_pc_sg1": "percent",
    "wet_pc_sg2": "percent",
    "pac_pc_sse": "percent",
    "swc_pc_s10": "percent",
    "swc_pc_s11": "percent",
    "swc_pc_s12": "percent",
    "clz_cl_smj": "dimensionless",
    "gwt_cm_sav": "centimeter",
    "glc_pc_s17": "percent",
    "glc_pc_s18": "percent",
    "hft_ix_s93": "dimensionless",
    "glc_pc_s15": "percent",
    "ire_pc_sse": "percent",
    "glc_pc_s16": "percent",
    "glc_pc_s13": "percent",
    "prm_pc_sse": "percent",
    "glc_pc_s14": "percent",
    "glc_pc_s11": "percent",
    "glc_pc_s12": "percent",
    "glc_pc_s10": "percent",
    "kar_pc_sse": "percent",
    "slp_dg_sav": "degree",
    "glc_pc_s19": "percent",
    "tmp_dc_s07": "degree_Celsius",
    "tmp_dc_s08": "degree_Celsius",
    "tmp_dc_s05": "degree_Celsius",
    "tmp_dc_s06": "degree_Celsius",
    "tmp_dc_s09": "degree_Celsius",
    "for_pc_sse": "percent",
    "aet_mm_s06": "millimeter",
    "aet_mm_s05": "millimeter",
    "aet_mm_s08": "millimeter",
    "aet_mm_s07": "millimeter",
    "aet_mm_s09": "millimeter",
    "tmp_dc_s10": "degree_Celsius",
    "tmp_dc_s11": "degree_Celsius",
    "aet_mm_s02": "millimeter",
    "aet_mm_s01": "millimeter",
    "tmp_dc_s12": "degree_Celsius",
    "aet_mm_s04": "millimeter",
    "aet_mm_s03": "millimeter",
    "lit_cl_smj": "dimensionless",
    "tmp_dc_s03": "degree_Celsius",
    "tmp_dc_s04": "degree_Celsius",
    "tmp_dc_s01": "degree_Celsius",
    "tmp_dc_s02": "degree_Celsius",
    "cls_cl_smj": "dimensionless",
    "pre_mm_syr": "millimeter",
    "pnv_pc_s01": "percent",
    "pnv_pc_s04": "percent",
    "pnv_pc_s05": "percent",
    "pnv_pc_s02": "percent",
    "rdd_mk_sav": "meters/km^2",
    "ele_mt_smn": "meter",
    "pnv_pc_s03": "percent",
    "pnv_pc_s08": "percent",
    "pnv_pc_s09": "percent",
    "pnv_pc_s06": "percent",
    "pnv_pc_s07": "percent",
    "wet_cl_smj": "dimensionless",
    "snw_pc_syr": "percent",
    "pnv_pc_s11": "percent",
    "pnv_pc_s12": "percent",
    "pnv_pc_s10": "percent",
    "pnv_pc_s15": "percent",
    "pnv_pc_s13": "percent",
    "pnv_pc_s14": "percent",
    "cmi_ix_syr": "dimensionless",
    "pet_mm_s11": "millimeter",
    "pet_mm_s12": "millimeter",
    "pet_mm_s10": "millimeter",
    "tmp_dc_smn": "degree_Celsius",
    "wet_pc_s08": "percent",
    "wet_pc_s09": "percent",
    "slt_pc_sav": "percent",
    "wet_pc_s02": "percent",
    "wet_pc_s03": "percent",
    "wet_pc_s01": "percent",
    "hdi_ix_sav": "dimensionless",
    "wet_pc_s06": "percent",
    "wet_pc_s07": "percent",
    "wet_pc_s04": "percent",
    "wet_pc_s05": "percent",
    "fec_cl_smj": "dimensionless",
    "glc_cl_smj": "dimensionless",
    "swc_pc_syr": "percent",
    "hft_ix_s09": "dimensionless",
    "soc_th_sav": "tonnes/hectare",
    "gdp_ud_sav": "dimensionless",  # "US dollars",
    "gdp_ud_ssu": "dimensionless",  # "US dollars",
    "tmp_dc_smx": "degree_Celsius",
    "cly_pc_sav": "percent",
    "pet_mm_s02": "millimeter",
    "pet_mm_s03": "millimeter",
    "pet_mm_s01": "millimeter",
    "snw_pc_smx": "percent",
    "ppd_pk_sav": "1/km^2",
    "pet_mm_s08": "millimeter",
    "aet_mm_s11": "millimeter",
    "pet_mm_s09": "millimeter",
    "aet_mm_s10": "millimeter",
    "pet_mm_s06": "millimeter",
    "pet_mm_s07": "millimeter",
    "aet_mm_s12": "millimeter",
    "pet_mm_s04": "millimeter",
    "pet_mm_s05": "millimeter",
    "inu_pc_slt": "percent",
    "ero_kh_sav": "kg/hectare/year",
    "aet_mm_syr": "millimeter",
    "cmi_ix_s10": "dimensionless",
    "cmi_ix_s11": "dimensionless",
    "cmi_ix_s12": "dimensionless",
    "ari_ix_sav": "dimensionless",
    "tmp_dc_syr": "degree_Celsius",
    "tec_cl_smj": "dimensionless",
    "fmh_cl_smj": "dimensionless",
    "inu_pc_smn": "percent",
    "pnv_cl_smj": "dimensionless",
    "pre_mm_s08": "millimeter",
    "pre_mm_s09": "millimeter",
    "run_mm_syr": "millimeter",
    "pre_mm_s06": "millimeter",
    "pre_mm_s07": "millimeter",
    "pre_mm_s04": "millimeter",
    "pre_mm_s05": "millimeter",
    "snd_pc_sav": "percent",
    "pre_mm_s02": "millimeter",
    "pre_mm_s03": "millimeter",
    "ele_mt_sav": "meter",
    "pre_mm_s01": "millimeter",
    "urb_pc_sse": "percent",
    "lka_pc_sse": "percent",
    "pre_mm_s10": "millimeter",
    "snw_pc_s01": "percent",
    "snw_pc_s02": "percent",
    "snw_pc_s03": "percent",
    "snw_pc_s04": "percent",
    "snw_pc_s05": "percent",
    "snw_pc_s06": "percent",
    "gla_pc_sse": "percent",
    "snw_pc_s07": "percent",
    "snw_pc_s08": "percent",
    "snw_pc_s09": "percent",
    "inu_pc_smx": "percent",
    "pre_mm_s11": "millimeter",
    "pre_mm_s12": "millimeter",
    "cmi_ix_s07": "dimensionless",
    "cmi_ix_s08": "dimensionless",
    "cmi_ix_s05": "dimensionless",
    "cmi_ix_s06": "dimensionless",
    "cmi_ix_s09": "dimensionless",
    "snw_pc_s10": "percent",
    "snw_pc_s11": "percent",
    "snw_pc_s12": "percent",
    "cmi_ix_s03": "dimensionless",
    "cmi_ix_s04": "dimensionless",
    "cmi_ix_s01": "dimensionless",
    "cmi_ix_s02": "dimensionless",
    "pst_pc_sse": "percent",
    "dis_m3_pmn": "m^3/second",
    "dis_m3_pmx": "m^3/second",
    "dis_m3_pyr": "m^3/second",
    "lkv_mc_usu": "10^6*m^3",
    "rev_mc_usu": "10^6*m^3",
    "ria_ha_usu": "hectare",
    "riv_tc_usu": "10^3*m^3",
    "pop_ct_usu": "dimensionless",
    "dor_pc_pva": "percent",
    "area": "km^2",
    "area_fraction_used_for_aggregation": "dimensionless",
}
GEE_GPM_UNITS = {
    "HQprecipitation": "mm/h",
    "IRkalmanFilterWeight": "percent",
    "IRprecipitation": "mm/h",
    "precipitationCal": "mm/h",
    "precipitationUncal": "mm/h",
    "probabilityLiquidPrecipitation": "percent",
    "randomError": "mm/h",
}
GEE_GFS_UNITS = {
    "temperature_2m_above_ground": "°C",
    "specific_humidity_2m_above_ground": "dimensionless",
    "relative_humidity_2m_above_ground": "percent",
    "u_component_of_wind_10m_above_ground": "m/s",
    "v_component_of_wind_10m_above_ground": "m/s",
    # kg/m^2 is the same as mm, as it's hourly data, we can consider it as mm/h
    "total_precipitation_surface": "mm/h",
    "precipitable_water_entire_atmosphere": "mm",
    "total_cloud_cover_entire_atmosphere": "percent",
    "downward_shortwave_radiation_flux": "W/m^2",
    # we divide total_precipitation_surface to each-hourly data
    "hourly_precipitation": "mm/h",
}
GEE_SMAP_UNITS = {
    "sm_surface": "dimensionless",
    "sm_rootzone": "dimensionless",
    "sm_profile": "dimensionless",
    "sm_surface_wetness": "dimensionless",
    "sm_rootzone_wetness": "dimensionless",
    "sm_profile_wetness": "dimensionless",
    "surface_temp": "K",
    "soil_temp_layer1": "K",
    "soil_temp_layer2": "K",
    "soil_temp_layer3": "K",
    "soil_temp_layer4": "K",
    "soil_temp_layer5": "K",
    "soil_temp_layer6": "K",
    "snow_mass": "kg/m^2",
    # we didn't use this variable yet, but it repeats with smap data, so we add a postfix "_smap"
    "snow_depth_smap": "m",
    "land_evapotranspiration_flux": "kg/m^2/s",
    "overland_runoff_flux": "kg/m^2/s",
    "baseflow_flux": "kg/m^2/s",
    "snow_melt_flux": "kg/m^2/s",
    "soil_water_infiltration_flux": "kg/m^2/s",
    "land_fraction_saturated": "dimensionless",
    "land_fraction_unsaturated": "dimensionless",
    "land_fraction_wilting": "dimensionless",
    "land_fraction_snow_covered": "dimensionless",
    "heat_flux_sensible": "W/m^2",
    "heat_flux_latent": "W/m^2",
    "heat_flux_ground": "W/m^2",
    "net_downward_shortwave_flux": "W/m^2",
    "net_downward_longwave_flux": "W/m^2",
    "radiation_shortwave_downward_flux": "W/m^2",
    "radiation_longwave_absorbed_flux": "W/m^2",
    # TODO: these fluxes should be checked. we didn't use them yet
    "precipitation_total_surface_flux": "kg/m^2/s^2",
    "snowfall_surface_flux": "kg/m^2/s^2",
    # TODO: GEE shows this variable as "K", I think it should be Pa
    # we didn't use this variable yet, but it repeats with era5land data, so we add a postfix "_smap"
    "surface_pressure_smap": "Pa",
    "height_lowatmmodlay": "m",
    "temp_lowatmmodlay": "K",
    "specific_humidity_lowatmmodlay": "dimensionless",
    "windspeed_lowatmmodlay": "m/s",
    "vegetation_greenness_fraction": "dimensionless",
    "leaf_area_index": "dimensionless",
    "sm_rootzone_pctl": "%",
    "sm_profile_pctl": "%",
    "depth_to_water_table_from_surface_in_peat": "m",
    "free_surface_water_on_peat_flux": "kg/m^2/s",
    "mwrtm_vegopacity": "dimensionless",
    "sm_surface_anomaly": "dimensionless",
}
GEE_ERA5LAND_HOURLY_UNITS = {
    "dewpoint_temperature_2m": "K",
    "temperature_2m": "K",
    "skin_temperature": "K",
    "soil_temperature_level_1": "K",
    "soil_temperature_level_2": "K",
    "soil_temperature_level_3": "K",
    "soil_temperature_level_4": "K",
    "lake_bottom_temperature": "K",
    "lake_ice_depth": "m",
    "lake_ice_temperature": "K",
    "lake_mix_layer_depth": "m",
    "lake_mix_layer_temperature": "K",
    "lake_shape_factor": "dimensionless",
    "lake_total_layer_temperature": "K",
    "snow_albedo": "dimensionless",
    "snow_cover": "%",
    "snow_density": "kg/m^3",
    # we didn't use this variable yet, but it repeats with smap data, so we add a postfix "_era5landhourly"
    "snow_depth_hourly": "m",
    "snow_depth_water_equivalent": "m",
    "snowfall": "m",
    "snowmelt": "m",
    "temperature_of_snow_layer": "K",
    "skin_reservoir_content": "m",
    "volumetric_soil_water_layer_1": "dimensionless",
    "volumetric_soil_water_layer_2": "dimensionless",
    "volumetric_soil_water_layer_3": "dimensionless",
    "volumetric_soil_water_layer_4": "dimensionless",
    "forecast_albedo": "dimensionless",
    "surface_latent_heat_flux": "J/m^2",
    # this is accumulated value
    "surface_net_solar_radiation": "J/m^2",
    "surface_net_thermal_radiation": "J/m^2",
    "surface_sensible_heat_flux": "J/m^2",
    "surface_solar_radiation_downwards": "J/m^2",
    "surface_thermal_radiation_downwards": "J/m^2",
    "evaporation_from_bare_soil": "m",
    "evaporation_from_open_water_surfaces_excluding_oceans": "m",
    "evaporation_from_the_top_of_canopy": "m",
    "evaporation_from_vegetation_transpiration": "m",
    "potential_evaporation": "m",
    "runoff": "m",
    "snow_evaporation": "m",
    "sub_surface_runoff": "m",
    "surface_runoff": "m",
    "total_evaporation": "m",
    "u_component_of_wind_10m": "m/s",
    "v_component_of_wind_10m": "m/s",
    # we didn't use this variable yet, but it repeats with smap data, so we add a postfix "_era5landhourly"
    "surface_pressure": "Pa",
    "total_precipitation": "m",
    "leaf_area_index_high_vegetation": "dimensionless",
    "leaf_area_index_low_vegetation": "dimensionless",
    "snowfall_hourly": "m/h",
    "snowmelt_hourly": "m/h",
    "surface_latent_heat_flux_hourly": "J/m^2/h",
    "surface_net_solar_radiation_hourly": "J/m^2/h",
    "surface_net_thermal_radiation_hourly": "J/m^2/h",
    "surface_sensible_heat_flux_hourly": "J/m^2/h",
    "surface_solar_radiation_downwards_hourly": "J/m^2/h",
    "surface_thermal_radiation_downwards_hourly": "J/m^2/h",
    "evaporation_from_bare_soil_hourly": "m/h",
    "evaporation_from_open_water_surfaces_excluding_oceans_hourly": "m/h",
    "evaporation_from_the_top_of_canopy_hourly": "m/h",
    "evaporation_from_vegetation_transpiration_hourly": "m/h",
    "potential_evaporation_hourly": "m/h",
    "runoff_hourly": "m/h",
    "snow_evaporation_hourly": "m/h",
    "sub_surface_runoff_hourly": "m/h",
    "surface_runoff_hourly": "m/h",
    "total_evaporation_hourly": "m/h",
    "total_precipitation_hourly": "m/h",
}


def check_units_in_pint(units_dict):
    """
    Check which units in the given dictionary are not recognized by Pint.

    Parameters:
    units_dict (dict): A dictionary where keys are variable names and values are units.

    Returns:
    list: A list of units that are not recognized by Pint.
    """
    unrecognized_units = []
    for variable, unit in units_dict.items():
        try:
            ureg(unit)
        except pint.errors.UndefinedUnitError:
            unrecognized_units.append(unit)
    return unrecognized_units


if __name__ == "__main__":
    # Check the units in the HYDROATLAS_UNITS dictionary
    unrecognized_units_hydroatlas = check_units_in_pint(HYDROATLAS_UNITS)
    print("Unrecognized HYDROATLAS units:", unrecognized_units_hydroatlas)
    unrecognized_units_era5land = check_units_in_pint(GEE_ERA5LAND_DAILY_UNITS)
    print("Unrecognized GEE_ERA5LAND_DAILY units:", unrecognized_units_era5land)
    unrecognized_units_gpm = check_units_in_pint(GEE_GPM_UNITS)
    print("Unrecognized GEE_GPM units:", unrecognized_units_gpm)
    unrecognized_units_gfs = check_units_in_pint(GEE_GFS_UNITS)
    print("Unrecognized GEE_GFS units:", unrecognized_units_gfs)
    unrecognized_units_smap = check_units_in_pint(GEE_SMAP_UNITS)
    print("Unrecognized GEE_SMAP units:", unrecognized_units_smap)
    unrecognized_units_era5land_hourly = check_units_in_pint(GEE_ERA5LAND_HOURLY_UNITS)
    print("Unrecognized GEE_ERA5LAND_HOURLY units:", unrecognized_units_era5land_hourly)
    unrecognized_units_streamflow = check_units_in_pint(STREAMFLOW_UNITS)
    print("Unrecognized STREAMFLOW units:", unrecognized_units_streamflow)